<template>
  <div id="reportQuery">
    <el-card class="box-card" style="margin:15px">
      <el-form
        ref="basicForm"
        :rules="basicDataRules"
        :inline="true"
        :model="basicData.model"
        class="demo-form-inline"
        size="small"
        label-width="150px"
      >
        <el-row>
          <el-col :span="6">
            <el-form-item label="所属区县:" width="300px" prop="areaId.key">
              <el-select
                size="mini"
                v-model="basicData.model.areaId.key"
                placeholder="选择"
                @change="clickOrgTree"
              >
                <el-option
                  v-for="(item, index) in orgTree"
                  :key="index"
                  :label="item.label"
                  :value="item.id"
                  width="300px"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="所属医院:" prop="hospitalId.key">
              <el-select
                size="mini"
                v-model="basicData.model.hospitalId.key"
                placeholder="选择"
                @change="clickOrgTreeC"
              >
                <el-option
                  v-for="(item, index) in orgTreeC"
                  :key="index"
                  :label="item.label"
                  :value="item.id"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="所属部门:" prop="departId.key">
              <el-select size="mini" v-model="basicData.model.departId.key" placeholder="选择">
                <el-option
                  v-for="(item, index) in orgTreeCs"
                  :key="index"
                  :label="item.label"
                  :value="item.id"
                />
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="6">
            <el-form-item label="母亲姓名:" prop="momName">
              <el-input size="mini" v-model="basicData.model.momName" placeholder="输入" />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="母亲身份证:" prop="momCard">
              <el-input size="mini" v-model="basicData.model.momCard" placeholder="输入" />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="手机号码:" prop="phone">
              <el-input size="mini" v-model="basicData.model.phone" placeholder="输入" />
            </el-form-item>
          </el-col>

          <el-col :span="6">
            <el-form-item label="实验结论:" prop="experimentResult.key">
              <el-select
                size="mini"
                v-model="basicData.model.experimentResult.key"
                placeholder="全部"
              >
                <el-option
                  v-for="(item, key, index) in dicts.EXPERIMENT_RESULT"
                  :key="index"
                  :label="item"
                  :value="key"
                />
              </el-select>
            </el-form-item>
          </el-col>

          <el-col :span="6">
            <el-form-item label="流程状态:" prop="flowStatus.key">
              <el-select size="mini" v-model="basicData.model.flowStatus.key" placeholder="请选择">
                <el-option
                  v-for="(item, key, index) in dicts.FLOW_STATUS"
                  :key="index"
                  :label="item"
                  :value="key"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="样本质量:" prop="sampleQuality.key">
              <el-select size="mini" v-model="basicData.model.sampleQuality.key" placeholder="请选择">
                <el-option
                  v-for="(item, key, index) in dicts.SAMPLE_QUALITY"
                  :key="index"
                  :label="item"
                  :value="key"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="样本属性:" prop="bloodProperty.key">
              <el-select size="mini" v-model="basicData.model.bloodProperty.key" placeholder="请选择">
                <el-option
                  v-for="(item, key, index) in dicts.BLOOD_PROPERTY"
                  :key="index"
                  :label="item"
                  :value="key"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="婴儿性别:" prop="babySex.key">
              <el-radio-group v-model="basicData.model.babySex.key">
                <el-radio
                  v-for="(item, key, index) in dicts.BABY_SEX"
                  :key="item"
                  :label="key"
                >{{ item }}</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-col :span="12" style="display:flex;padding-left: 2.5vw;" class="time-list">
              <el-form-item style="width:100%">
                <el-select
                  size="mini"
                  style="width:120px !important"
                  v-model="timeType"
                  placeholder="出生日期"
                >
                  <el-option
                    v-for="(item, key, index) in dicts.TIME"
                    :key="index"
                    :label="item"
                    :value="key"
                  />
                </el-select>
                <el-date-picker
                  size="mini"
                  v-model="timeList"
                  type="daterange"
                  value-format="yyyy-MM-dd"
                  style="width:100%"
                  range-separator="至"
                  start-placeholder="开始日期"
                  end-placeholder="结束日期"
                />
              </el-form-item>
            </el-col>
            <el-col :span="12" style="display:flex;padding-left: 2.5vw;">
              <el-form-item>
                <el-select
                  style="width:96px !important"
                  size="mini"
                  v-model="codeType"
                  placeholder="条形码号"
                >
                  <el-option
                    v-for="(item, key, index) in dicts.NUMBER"
                    :key="index"
                    :label="item"
                    :value="key"
                  />
                </el-select>
              </el-form-item>
              <div style="display:flex;align-items: center;width:100%">
                <el-form-item style="width:100%">
                  <el-input
                    size="mini"
                    v-model="codeList.start"
                    placeholder="输入"
                    style="width:100%"
                  />
                </el-form-item>
                <span style="margin: 0 17px">至</span>
                <el-form-item style="width:100%">
                  <el-input size="mini" style="width:100%" v-model="codeList.end" placeholder="输入" />
                </el-form-item>
              </div>
            </el-col>
          </el-col>
          <el-col id="shiyan" :span="24" class="more-col">
            <el-form-item label="实验项目:" class="pj" prop="experimentProject">
              <el-checkbox-group v-model="basicData.model.experimentProject">
                <el-checkbox
                  v-for="(item, key, index) in dicts.EXPERIMENT_CODE"
                  :label="key"
                  name="type"
                >{{ item }}</el-checkbox>
              </el-checkbox-group>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div class="buttom" style="margin-top: 7px;">
        <el-button
          type="primary"
          size="small"
          style="width:100px"
          icon="el-icon-search"
          @click="onSubmit('query')"
        >查询</el-button>
        <el-button size="small" @click="onSubmit('reset')">重置</el-button>
      </div>
    </el-card>
    <el-card class="box-card" style="margin:5px 15px;">
      <div style="margin-bottom:10px">
        <el-button size="small" type="primary" icon="el-icon-printer" @click="clickPrint">打印</el-button>
        <el-button size="small">导出</el-button>
      </div>
      <el-table
        id="box-table"
        v-loading="loading"
        :data="tableData"
        style="width: 100%;padding:5px;"
        :header-cell-style="{
          background: '#333333',
          color: '#ffffff',
          textAlign: 'center'
        }"
        @selection-change="onSelectChange"
      >
        <el-table-column align="center" type="selection" width="55" />
        <el-table-column align="center" type="index" width="55" />
        <el-table-column align="center" prop="barCode" sortable label="条形码号" width="150" />
        <el-table-column align="center" prop="expNum" sortable width="150" label="实验编号" />
        <el-table-column align="center" prop="momName" label="母亲姓名" />
        <el-table-column align="center" prop="birthTime" sortable width="100" label="出生日期">
          <template slot-scope="scope">
            <span>{{ scope.row.birthTime?scope.row.birthTime.substr(0, 10):'' }}</span>
          </template>
        </el-table-column>
        <el-table-column align="center" prop="babySex.data" label="性别" />
        <el-table-column
          align="center"
          prop="hospitalId.data.label"
          show-overflow-tooltip
          label="所属医院"
        />
        <el-table-column align="center" prop="sumExperimentResult" label="实验结论" />
        <el-table-column align="center" prop="experimentKeywords.data" label="实验项目">
          <template slot-scope="scope">
            <span
              v-html="scope.row.experimentKeywords.data"
              @click="scope.row.sumExperimentCode?clickSeeExpValue(scope.row):''"
            ></span>
          </template>
        </el-table-column>
        <el-table-column align="center" prop="bloodTime" sortable width="100" label="采血日期">
          <template slot-scope="scope">
            <span>{{ scope.row.bloodTime?scope.row.bloodTime.substr(0, 10):'' }}</span>
          </template>
        </el-table-column>
        <el-table-column align="center" prop="phone" label="手机号码" />
        <el-table-column align="center" prop="printNumber" label="打印次数" />
        <el-table-column align="center" prop="smsSendStatus.data" label="发送状态" />
      </el-table>
      <el-pagination
        :current-page="basicData.current"
        :page-size="basicData.size"
        :total="total"
        layout="slot,total, sizes, prev, pager, next, jumper"
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
      >
        <span
          v-if="tableData.length > 0"
          style="font-weight: 400;color:#606266"
        >已选中{{ tableData.length }}条，</span>
      </el-pagination>
    </el-card>
    <el-dialog :visible.sync="dialogShow" width="85%" center custom-class="print-dialog">
      <span
        slot="title"
        class="dialog-title"
        style="font-size: 18px;font-weight: 400;color:#fff"
      >报告打印</span>
      <!-- 传统 -->
      <chuantong :dataList="printData" v-if="printType == 'PHE+TSH+17_a_OHP+G6PD'"></chuantong>
      <!-- 串联 -->
      <chuanlian :dataList="printData" v-if="printType == 'MSMS'"></chuanlian>
      <!-- 地贫 -->
      <diping :dataList="printData" v-if="printType == 'THA'"></diping>
      <!-- 耳聋基因 -->
      <erlongjiyin :dataList="printData" v-if="printType == 'DGT'"></erlongjiyin>
      <span slot="footer" class="dialog-footer">
        <el-button v-print="'#print'" size="small" type="primary" style="padding: 6px 19px;">打 印</el-button>
      </span>
    </el-dialog>

    <!-- 点击查看 -->
    <el-dialog width="65%" title="实验数据" :visible.sync="seeShow" append-to-body>
      <!-- 表格 -->
      <el-row style="line-height: 1.5;border:1px solid">
        <el-col
          :span="5"
          style="display:flex;justify-content: center;color:#000000f2;font-size: 15px;border-right:1px solid"
        >筛查项目</el-col>
        <el-col
          :span="3"
          style="display:flex;justify-content: center;color:#000000f2;font-size: 15px;border-right:1px solid"
        >检测指标</el-col>
        <el-col
          :span="3"
          style="display:flex;justify-content: center;color:#000000f2;font-size: 15px;border-right:1px solid"
        >检测值</el-col>
        <el-col
          :span="5"
          style="display:flex;justify-content: center;color:#000000f2;font-size: 15px;border-right:1px solid"
        >正常参考值</el-col>
        <el-col
          :span="8"
          style="display:flex;justify-content: center;color:#000000f2;font-size: 15px;"
        >筛查结果</el-col>
        <!-- hint -->
      </el-row>
      <!-- 表格内容 -->
      <el-row
        style="line-height: 1.5;border-bottom:1px solid;border-left:1px solid;border-right:1px solid;"
      >
        <div v-for="(item, key, index) in seeData" :key="index">
          <el-col
            :span="5"
            :style="item.experimentValueResult != 'normal' ? 'background-color:#baccef;':''"
            style="display:flex;justify-content: center;color:#000000f2;font-size: 15px;border-right:1px solid"
          >{{ item.indicatorCodeName }}&nbsp</el-col>
          <el-col
            :span="3"
            :style="item.experimentValueResult != 'normal' ? 'background-color:#baccef;':''"
            style="display:flex;justify-content: center;color:#000000f2;font-size: 15px;border-right:1px solid"
          >{{ item.indicatorCode }}&nbsp</el-col>
          <el-col
            :span="3"
            :style="item.experimentValueResult != 'normal' ? 'background-color:#baccef;':''"
            style="display:flex;justify-content: center;color:#000000f2;font-size: 15px;border-right:1px solid"
          >{{ item.experimentValue }}{{ item.units }}&nbsp</el-col>
          <el-col
            :span="5"
            :style="item.experimentValueResult != 'normal' ? 'background-color:#baccef;':''"
            style="display:flex;justify-content: center;color:#000000f2;font-size: 15px;border-right:1px solid"
          >{{ item.referenceValue }}&nbsp</el-col>
          <el-col
            :span="8"
            :style="item.experimentValueResult != 'normal' ? 'background-color:#baccef;':''"
            style="display:flex;justify-content: center;color:#000000f2;font-size: 15px;border-right:1px solid"
          >{{ item.hint }}&nbsp</el-col>
        </div>
      </el-row>
    </el-dialog>
  </div>
</template>

<script>
import { initDicts, downloadFile } from "@/utils/commons";
import orgApi from "@/api/Org.js";
import Project from "@/api/Project.js";
import QueryManageApi from "@/api/QueryManage.js";
import diping from "./diping.vue";
import chuantong from "./chuantong.vue";
import chuanlian from "./chuanlian.vue";
import erlongjiyin from "./erlongjiyin.vue";
export default {
  components: {
    diping,
    chuantong,
    chuanlian,
    erlongjiyin
  },
  data() {
    return {
      // 转菊花
      loading: false,
      // 是否展示更多信息
      morderShow: true,
      // 打印弹窗
      dialogShow: false,
      // 展开行转菊花
      expandeShow: false,
      // 页条数
      pageSize: 10,
      // 页数
      pageIndex: 1,
      // 表格数据
      tableData: [],
      //总数据
      total: 0,
      // 打印报告类型
      // printType:'PHE+TSH+17_a_OHP+G6PD',
      printType: "THA",
      // 打印数据
      printData: [],
      // 基本数据
      basicData: {
        current: 1,
        map: {},
        model: {
          areaId: {
            data: {
              abbreviation: "",
              createTime: "",
              createUser: 0,
              describe: "",
              id: 0,
              label: "",
              parentId: 0,
              sortValue: 0,
              status: true,
              treePath: "",
              type: {
                data: "",
                key: ""
              },
              updateTime: "",
              updateUser: 0
            },
            key: ""
          },
          babySex: {
            data: "",
            key: ""
          },
          barCode: {
            end: "",
            start: ""
          },
          birthTime: {
            end: "",
            start: ""
          },
          bloodNum: {
            end: "",
            start: ""
          },
          bloodProperty: {
            data: "",
            key: ""
          },
          bloodReview: {
            data: "",
            key: ""
          },
          bloodStatus: {
            data: "",
            key: ""
          },
          bloodTime: {
            end: "",
            start: ""
          },
          costType: {
            data: "",
            key: ""
          },
          createTime: {
            end: "",
            start: ""
          },
          days: 0,
          departId: {
            data: {
              abbreviation: "",
              createTime: "",
              createUser: 0,
              describe: "",
              id: 0,
              label: "",
              parentId: 0,
              sortValue: 0,
              status: true,
              treePath: "",
              type: {
                data: "",
                key: ""
              },
              updateTime: "",
              updateUser: 0
            },
            key: ""
          },
          expNum: {
            end: "",
            start: ""
          },
          experimentKeywords: "",
          experimentProject: ["THA"],
          experimentResult: {
            data: "",
            key: ""
          },
          experimentTime: {
            end: "",
            start: ""
          },
          fileStatus: {
            data: "",
            key: ""
          },
          flowStatus: {
            data: "",
            key: ""
          },
          freeNum: {
            end: "",
            start: ""
          },
          hospitalId: {
            data: {
              abbreviation: "",
              createTime: "",
              createUser: 0,
              describe: "",
              id: 0,
              label: "",
              parentId: 0,
              sortValue: 0,
              status: true,
              treePath: "",
              type: {
                data: "",
                key: ""
              },
              updateTime: "",
              updateUser: 0
            },
            key: ""
          },
          momCard: "",
          momName: "",
          payWay: {
            data: "",
            key: ""
          },
          phone: "",
          projectQueryType: {
            data: "",
            key: ""
          },
          projectReportType: {
            data: "",
            key: "THA"
          },
          reportTime: {
            end: "",
            start: ""
          },
          sampleQuality: {
            data: "",
            key: ""
          },
          sourceWay: {
            data: "",
            key: ""
          },
          weeks: 0,
          weight: 0
        },
        order: "descending",
        size: 10,
        sort: "id"
      },
      //时间类型
      timeType: "",
      //编码类型
      codeType: "",
      //时间列表
      timeList: [],
      // 编码
      codeList: {
        start: "",
        end: ""
      },
      // 校验
      basicDataRules: {
        "areaId.key": [{ required: false, message: "", trigger: "change" }],
        "hospitalId.key": [{ required: false, message: "", trigger: "change" }],
        "departId.key": [{ required: false, message: "", trigger: "change" }],
        momName: [{ required: false, message: "   ", trigger: "change" }],
        "babySex.key": [{ required: false, message: "   ", trigger: "change" }],
        momCard: [{ required: false, message: "   ", trigger: "change" }],
        phone: [{ required: false, message: "   ", trigger: "change" }],
        "experimentResult.key": [
          { required: false, message: "   ", trigger: "change" }
        ],
        "flowStatus.key": [
          { required: false, message: "   ", trigger: "change" }
        ],
        "sampleQuality.key": [
          { required: false, message: "请选择所属区县", trigger: "change" }
        ],
        "bloodProperty.key": [
          { required: false, message: "请选择所属区县", trigger: "change" }
        ],
        "projectReportType.key": [
          { required: false, message: "请选择所属区县", trigger: "change" }
        ],
        projectIdList: [
          { required: false, message: "请选择所属区县", trigger: "change" }
        ]
      },
      // 勾选的数据
      selectList: [],
      // 市县
      orgTree: [],
      // 医院
      orgTreeC: [],
      // 部门
      orgTreeCs: [],
      selectItem: {
        // 实验项目
        experimentProject: [],
        // 所属区县
        areaId: {
          key: ""
        },
        // 婴儿性别【男/女/未知】
        babySex: {
          data: "",
          key: ""
        },
        // 样本属性【默认未知，初检/复检】
        bloodProperty: {
          data: "",
          key: ""
        },
        // 所属部门
        departId: {
          key: ""
        },
        // 结束编号
        endNumber: 0,
        // 结束时间
        endTime: "",
        // 实验结论
        experimentResult: {
          key: ""
        },
        // 流程状态
        flowStatus: {
          key: ""
        },
        // 医院id
        hospitalId: {
          key: ""
        },
        // 母亲身份证
        momCard: "",
        // 母亲姓名
        momName: "",
        // 编号筛选
        num: "",
        // 手机号码
        phone: "",
        // 报告类型
        projectReportType: {
          data: "",
          key: ""
        },
        // 样本质量【默认合格，基础码表】
        sampleQuality: {
          key: ""
        },
        // 起始编号
        startNumber: 0,
        // 起始时间
        startTime: "",
        // 日期筛选
        time: ""
      },
      // 字典
      dicts: {
        BABY_SEX: {}, //性别
        EXPERIMENT_RESULT: {}, //实验结论
        FLOW_STATUS: {}, //流程状态
        SAMPLE_QUALITY: {}, //样本质量
        BLOOD_PROPERTY: {}, //样本属性
        TIME: {}, //日期筛选
        NUMBER: {}, //编码筛选
        EXPERIMENT_CODE: {}, //编码筛选
        REPORT_TYPE: {} //报告类型
      },
      // 展开行数据
      expandList: [],
      // 展开行id
      expandId: [],
      getRowKeys(row) {
        return row.id;
      },
      seeShow: false,
      seeData: {}
    };
  },
  mounted() {
    initDicts(
      [
        "BABY_SEX",
        "EXPERIMENT_RESULT",
        "FLOW_STATUS",
        "SAMPLE_QUALITY",
        "BLOOD_PROPERTY",
        "EXPERIMENT_CODE",
        "TIME",
        "NUMBER",
        "REPORT_TYPE"
      ],
      this.dicts
    );
    // 获取基础查询
    this.initOrgTree();
    // 获取表格数据
    this.getList(this.basicData);
  },
  methods: {
    // 点击查看
    clickSeeExpValue(v) {
      QueryManageApi.reportQuery
        .viewReport({
          code: v.experimentKeywords.key,
          sampleId: v.id
        })
        .then(res => {
          if (res.status == 200) {
            if (res.data.data) {
              this.dialogShow = true;
              this.printData = [res.data.data];
            }
          } else {
            this.$message.error(res.statusText);
          }
        });
    },
    // 根据选择市县获取医院
    clickOrgTree(v) {
      this.orgTreeC = [];
      this.orgTreeCs = [];
      this.basicData.model.hospitalId.key = "";
      this.basicData.model.departId.key = "";
      this.selectItem.hospitalId.key = "";
      this.selectItem.departId.key = "";
      this.orgTree.filter(res => {
        if (res.id == v) {
          this.orgTreeC = res.children;
        }
      });
    },
    // 根据选择市县获取医院
    clickOrgTreeC(v) {
      this.orgTreeCs = [];
      this.basicData.model.departId.key = "";
      this.selectItem.departId.key = "";
      this.orgTreeC.filter(res => {
        if (res.id == v) {
          this.orgTreeCs = res.children;
        }
      });
    },
    // 获取基础查询
    initOrgTree() {
      orgApi.allTree({}).then(response => {
        const res = response.data;
        this.orgTree = res.data[0].children;
      });
    },
    getList(data) {
      this.loading = true;
      QueryManageApi.reportQuery.page(data).then(res => {
        this.tableData = res.data.data.records;
        this.tableData.forEach((item, index) => {
          if (item.sumExperimentCode) {
            let keyList = [];
            let keyTitle = [];

            keyList = item.experimentKeywords.key.split("+");
            keyTitle = item.experimentKeywords.data.split("+");

            item.sumExperimentCode.split("+").forEach(i => {
              if (keyList.indexOf(i) > -1) {
                keyTitle[
                  keyList.indexOf(i)
                ] = `<span v-if="scope.row.sumExperimentCode" style="color: #1890ff;cursor: pointer;">${
                  keyTitle[keyList.indexOf(i)]
                }</span>`;
              }
            });
            item.experimentKeywords.data = keyTitle.join("+");
          }
        });
        this.total = res.data.data.total;
        this.loading = false;
      });
    },
    // 点击展示与收起
    onMoreStatus() {
      this.morderShow = !this.morderShow;
    },
    // 点击勾选
    onSelectChange(val) {
      this.selectList = val;
    },
    // 点击打印按钮
    clickPrint() {
      if (this.selectList.length == 0) {
        this.$message.error("请选择数据");
      } else {
        let data = [
          {
            experimentProject: [],
            sampleId: "0"
          }
        ];
        this.selectList.forEach((item, index) => {
          data[index] = {
            // experimentCode: item.experimentProject[0],
            experimentCode: item.experimentKeywords.key,
            sampleId: item.id
          };
        });
        QueryManageApi.reportQuery.printReport(data).then(res => {
          if (res.status == 200) {
            if (res.data.data) {
              this.dialogShow = true;
              this.printData = res.data.data;
              res.data.data.forEach((item, index) => {
                let sortData = [];
                for (let key in item.experimentValue) {
                  sortData.push(item.experimentValue[key]);
                }
                this.printData[index].experimentValue = this.$keysrt(
                  sortData,
                  "sortValue"
                );
              });
            }
          } else {
            this.$message.error(res.statusText);
          }
        });
      }
    },
    // 点击展开行
    expandChange(data, expandedRows) {
      this.expandeShow = true;
      QueryManageApi.reportQuery
        .getExperimentsById({ id: data.id })
        .then(res => {
          this.expandList = res.data.data;
          this.expandeShow = false;
        });
      var that = this;
      if (expandedRows.length) {
        that.expandId = [];
        if (data) {
          that.expandId.push(data.id); // 每次push进去的是每行的ID
        }
      } else {
        that.expandId = []; // 默认不展开
      }
    },
    // 基础信息按钮点击事件
    onSubmit(type) {
      if (type == "query") {
        switch (this.timeType) {
          // 出生日期"
          case "birthtime":
          case "":
            this.basicData.model.birthTime = {
              start: this.timeList[0],
              end: this.timeList[1]
            };
            this.basicData.model.bloodTime = {
              start: "",
              end: ""
            };
            this.basicData.model.createTime = {
              start: "",
              end: ""
            };
            this.basicData.model.experimentTime = {
              start: "",
              end: ""
            };
            this.basicData.model.reportTime = {
              start: "",
              end: ""
            };
            break;
          // 采血日期
          case "bloodtime":
            this.basicData.model.bloodTime = {
              start: this.timeList[0],
              end: this.timeList[1]
            };
            this.basicData.model.birthTime = {
              start: "",
              end: ""
            };
            this.basicData.model.createTime = {
              start: "",
              end: ""
            };
            this.basicData.model.experimentTime = {
              start: "",
              end: ""
            };
            this.basicData.model.reportTime = {
              start: "",
              end: ""
            };
            break;
          // 登记日期
          case "createtime":
            this.basicData.model.createTime = {
              start: this.timeList[0],
              end: this.timeList[1]
            };
            this.basicData.model.birthTime = {
              start: "",
              end: ""
            };
            this.basicData.model.bloodTime = {
              start: "",
              end: ""
            };
            this.basicData.model.experimentTime = {
              start: "",
              end: ""
            };
            this.basicData.model.reportTime = {
              start: "",
              end: ""
            };
            break;
          // 实验日期
          case "experimenttime":
            this.basicData.model.experimentTime = {
              start: this.timeList[0],
              end: this.timeList[1]
            };
            this.basicData.model.birthTime = {
              start: "",
              end: ""
            };
            this.basicData.model.bloodTime = {
              start: "",
              end: ""
            };
            this.basicData.model.createTime = {
              start: "",
              end: ""
            };
            this.basicData.model.reportTime = {
              start: "",
              end: ""
            };
            break;
          // 报告日期
          case "reporttime":
            this.basicData.model.reportTime = {
              start: this.timeList[0],
              end: this.timeList[1]
            };
            this.basicData.model.birthTime = {
              start: "",
              end: ""
            };
            this.basicData.model.bloodTime = {
              start: "",
              end: ""
            };
            this.basicData.model.createTime = {
              start: "",
              end: ""
            };
            this.basicData.model.experimentTime = {
              start: "",
              end: ""
            };
            break;
        }
        switch (this.codeType) {
          // 条形码号"
          case "barcode":
          case "":
            this.basicData.model.barCode = {
              start: this.codeList.start,
              end: this.codeList.end
            };
            this.basicData.model.bloodNum = {
              start: "",
              end: ""
            };
            this.basicData.model.expNum = {
              start: "",
              end: ""
            };
            this.basicData.model.freeNum = {
              start: "",
              end: ""
            };
            break;
          // 采血编号
          case "bloodnum":
            this.basicData.model.barCode = {
              start: this.codeList.start,
              end: this.codeList.end
            };
            this.basicData.model.bloodNum = {
              start: "",
              end: ""
            };
            this.basicData.model.expNum = {
              start: "",
              end: ""
            };
            this.basicData.model.freeNum = {
              start: "",
              end: ""
            };
            break;
          // 实验编号
          case "expnum":
            this.basicData.model.expNum = {
              start: this.codeList.start,
              end: this.codeList.end
            };
            this.basicData.model.bloodNum = {
              start: "",
              end: ""
            };
            this.basicData.model.barCode = {
              start: "",
              end: ""
            };
            this.basicData.model.freeNum = {
              start: "",
              end: ""
            };
            break;
          // 免费券号
          case "freenum":
            this.basicData.model.freeNum = {
              start: this.codeList.start,
              end: this.codeList.end
            };
            this.basicData.model.bloodNum = {
              start: "",
              end: ""
            };
            this.basicData.model.expNum = {
              start: "",
              end: ""
            };
            this.basicData.model.barCode = {
              start: "",
              end: ""
            };
            break;
        }
        this.printType = this.basicData.model.projectReportType.key;
        this.getList(this.basicData);
      } else if (type == "reset") {
        this.$refs["basicForm"].resetFields();
        this.timeType = "";
        this.codeType = "";
        this.timeList = [];
        this.codeList = {
          start: "",
          end: ""
        };
      }
    },
    // 点击分页
    handleSizeChange: function(val) {
      this.basicData.size = val;
      this.getList(this.basicData);
    },
    // 选择页码
    handleCurrentChange: function(currentPage) {
      this.basicData.current = currentPage;
      this.getList(this.basicData);
    }
  }
};
</script>

<style lang="less">
.flex {
  display: flex;
  align-items: center;
  justify-content: center;
}
#reportQuery {
  .el-form-item__content,
  .el-date-editor,
  .el-select,
  .el-textarea {
    width: 100% !important;
  }
  .pj {
    .el-form-item__label {
      width: 115px !important;
    }
  }
  #box-table {
    .el-table__body-wrapper {
      // max-height: calc(100vh - 44rem);
      overflow-y: auto;
    }
    #box-tables {
      .el-table__body-wrapper {
        max-height: none;
        overflow-y: unset;
      }
    }
  }
  .mores {
    .flex;
    justify-content: flex-start;
    width: 100%;
    background: #188ff233;
    height: 30px;
    padding: 5px 8px;
    .more-title {
      font-family: SourceHanSansSC;
      font-style: normal;
      letter-spacing: 0px;
      line-height: 20px;
      text-decoration: none;
      margin-right: 1rem;
      font-size: 14px;
      font-weight: 500;
      color: #000;
    }
  }

  #more-row {
    #shiyan {
      .projectIdList {
        .el-form-item__content {
          width: 80%;
        }
      }
    }
    .more-col {
      .remark {
        width: 100%;
        .el-form-item__content {
          width: 90%;
        }
      }
    }
    .el-form-item {
      .el-form-item__content {
        width: 400px;
      }
    }
  }
  .buttom {
    width: 100%;
    .flex;
  }
  .el-dialog__header {
    border-bottom: 1px solid #e0e0e0;
  }
  .print-form {
    max-height: 500px;
    overflow: auto;
    display: flex;
    flex-direction: column;
    flex-flow: wrap;
    .print-item {
      width: 50%;
      .flex;
      justify-content: flex-start;
      color: #222222;
      font-size: 15px;
      margin-top: 10px;
      .title {
        font-weight: bold;
        flex: 0.4;
      }
      .value {
        flex: 0.6;
        font-weight: bold;
        overflow-wrap: anywhere;
      }
    }
  }
  .el-dialog__footer {
    .flex;
  }
  .select-input {
    .picker {
      width: 500px;
    }
    .select-i {
      width: 300px;
    }
    @media screen and (max-width: 1600px) {
      .picker {
        width: 400px;
      }
      .select-i {
        width: 150px;
      }
    }
    .flex;
    .el-select .el-input {
      width: 110px;
    }
    .input-with-select .el-input-group__prepend {
      background-color: #fff;
    }
  }

  .print-dialog {
    .el-dialog__footer {
      .flex;
    }
    .el-dialog__header {
      background: #2669f3;
    }
    .el-dialog__body {
      height: 580px;
      overflow-y: auto;
    }
  }
}
</style>
